package org.idea.spring.aop.demo;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @Author linhao
 * @Date created in 10:50 上午 2021/5/4
 */
public class MainClass {

    public static void main(String[] args) throws InterruptedException {
        AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext();
        annotationConfigApplicationContext.registerBean(MyConfig.class);
        annotationConfigApplicationContext.refresh();
        Calculate myCalculate = annotationConfigApplicationContext.getBean(Calculate.class);
        myCalculate.add(0, 0);
        for (int i = 0; i < 1000; i++) {
            Thread.sleep(3000);
            System.out.println("====="+myCalculate.getClass().toString());
        }
        annotationConfigApplicationContext.close();

    }
}
